home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 3 'Fixed Dialog
- Caption = "GetFileVersionInfo 32"
- ClientHeight = 4965
- ClientLeft = 1140
- ClientTop = 1485
- ClientWidth = 5820
- Height = 5370
- Icon = "filever.frx":0000
- KeyPreview = -1 'True
- Left = 1080
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4965
- ScaleWidth = 5820
- ShowInTaskbar = 0 'False
- Top = 1140
- Width = 5940
- Begin VB.PictureBox Picture1
- BackColor = &H00FFFFFF&
- Height = 2415
- Left = 120
- ScaleHeight = 2355
- ScaleWidth = 5475
- TabIndex = 7
- TabStop = 0 'False
- Top = 2100
- Width = 5535
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H000000C0&
- Height = 195
- Index = 0
- Left = 1680
- TabIndex = 27
- Top = 0
- Width = 3750
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "File Name"
- ForeColor = &H80000008&
- Height = 195
- Index = 9
- Left = 0
- TabIndex = 26
- Top = 0
- Width = 1515
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H00800000&
- Height = 195
- Index = 1
- Left = 1680
- TabIndex = 25
- Top = 240
- Width = 3750
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "File Date/Size"
- ForeColor = &H80000008&
- Height = 195
- Index = 0
- Left = 0
- TabIndex = 24
- Top = 240
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Company Name"
- ForeColor = &H80000008&
- Height = 195
- Index = 1
- Left = 0
- TabIndex = 23
- Top = 480
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "File Description"
- ForeColor = &H80000008&
- Height = 195
- Index = 2
- Left = 0
- TabIndex = 22
- Top = 720
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "File Version"
- ForeColor = &H80000008&
- Height = 195
- Index = 3
- Left = 0
- TabIndex = 21
- Top = 960
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Internal Name"
- ForeColor = &H80000008&
- Height = 195
- Index = 4
- Left = 0
- TabIndex = 20
- Top = 1200
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Legal Copyright"
- ForeColor = &H80000008&
- Height = 195
- Index = 5
- Left = 0
- TabIndex = 19
- Top = 1440
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Original File Name"
- ForeColor = &H80000008&
- Height = 195
- Index = 6
- Left = 0
- TabIndex = 18
- Top = 1680
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Product Name"
- ForeColor = &H80000008&
- Height = 195
- Index = 7
- Left = 0
- TabIndex = 17
- Top = 1920
- Width = 1515
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Product Version"
- ForeColor = &H80000008&
- Height = 195
- Index = 8
- Left = 0
- TabIndex = 16
- Top = 2160
- Width = 1515
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 2
- Left = 1680
- TabIndex = 15
- Top = 480
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 3
- Left = 1680
- TabIndex = 14
- Top = 720
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 4
- Left = 1680
- TabIndex = 13
- Top = 960
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 5
- Left = 1680
- TabIndex = 12
- Top = 1200
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 6
- Left = 1680
- TabIndex = 11
- Top = 1440
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 7
- Left = 1680
- TabIndex = 10
- Top = 1680
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 8
- Left = 1680
- TabIndex = 9
- Top = 1920
- Width = 3750
- End
- Begin VB.Label lblValue
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 195
- Index = 9
- Left = 1680
- TabIndex = 8
- Top = 2160
- Width = 3750
- End
- End
- Begin VB.FileListBox File1
- Height = 1425
- Left = 120
- TabIndex = 2
- Top = 600
- Width = 2895
- End
- Begin VB.DirListBox Dir1
- Height = 1155
- Left = 3120
- TabIndex = 6
- Top = 860
- Width = 2535
- End
- Begin VB.DriveListBox Drive1
- Height = 315
- Left = 3120
- TabIndex = 4
- Top = 240
- Width = 2535
- End
- Begin VB.TextBox txtFileName
- Height = 315
- Left = 120
- TabIndex = 1
- Top = 240
- Width = 2895
- End
- Begin VB.Label Label3
- BackStyle = 0 'Transparent
- Caption = "MMC Software info@mmcsoftware.com or CompuServe: 72500,1406"
- ForeColor = &H00000000&
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 29
- Top = 4740
- Width = 5535
- End
- Begin VB.Label Label3
- BackStyle = 0 'Transparent
- Caption = "Copyright
- 1995, David Warren"
- ForeColor = &H00000000&
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 28
- Top = 4560
- Width = 2475
- End
- Begin VB.Label Label2
- Caption = "Di&rectory"
- Height = 195
- Index = 2
- Left = 3120
- TabIndex = 5
- Top = 600
- Width = 1275
- End
- Begin VB.Label Label2
- Caption = "&Drive"
- Height = 195
- Index = 1
- Left = 3120
- TabIndex = 3
- Top = 0
- Width = 1275
- End
- Begin VB.Label Label2
- Caption = "&File Name"
- Height = 195
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 1275
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub GetFileVersionData()
- On Error GoTo GetFileVersionData_Error
- Dim sFileName As String, sInfo As String, sMsg As String
- Dim lResult As Long, iDelim As Integer, n As Integer, lHandle As Long
- If txtFileName.Text <> "" Then
- For n = 2 To 9
- lblValue(n).Caption = ""
- Next n
- sFileName = txtFileName.Text
- lblValue(0).Caption = UCase$(sFileName)
- lblValue(1).Caption = Format$(FileDateTime(sFileName), "MM/DD/YY HH:MM:SS") & Space(10) & Format$(FileLen(sFileName), "###,###,###") & " bytes"
-
- lHandle = 0
- 'how big is the Version Info block?
- lSizeof = GetFileVersionInfoSize(sFileName, lHandle)
- If lSizeof > 0 Then
-
- sInfo = String$(lSizeof, 0)
- lResult = GetFileVersionInfo(ByVal sFileName, 0&, ByVal lSizeof, ByVal sInfo)
- If lResult Then
-
-
- 'now parse the returned string:
-
- ' NOTE: I found the formal method using VerGetValue()
- ' to be somewhat unreliable, sometimes failing to
- ' return the correct information. Instead, simply
- ' parse the string as follows:
- iDelim = InStr(sInfo, "CompanyName")
- If iDelim > 0 Then
- iDelim = iDelim + 12
- lblValue(2).Caption = Mid$(sInfo, iDelim)
- End If
-
- iDelim = InStr(sInfo, "FileDescription")
- If iDelim > 0 Then
- iDelim = iDelim + 16
- lblValue(3).Caption = Mid$(sInfo, iDelim)
- End If
-
- iDelim = InStr(sInfo, "FileVersion")
- If iDelim > 0 Then
- iDelim = iDelim + 12
- lblValue(4).Caption = Mid$(sInfo, iDelim)
- End If
-
- iDelim = InStr(sInfo, "InternalName")
- If iDelim > 0 Then
- iDelim = iDelim + 16
- lblValue(5).Caption = Mid$(sInfo, iDelim)
- End If
-
- iDelim = InStr(sInfo, "LegalCopyright")
- If iDelim > 0 Then
- iDelim = iDelim + 16
- lblValue(6).Caption = Mid$(sInfo, iDelim)
- End If
-
- iDelim = InStr(sInfo, "OriginalFilename")
- If iDelim > 0 Then
- iDelim = iDelim + 20
- lblValue(7).Caption = Mid$(sInfo, iDelim)
- End If
- iDelim = InStr(sInfo, "ProductName")
- If iDelim > 0 Then
- iDelim = iDelim + 12
- lblValue(8).Caption = Mid$(sInfo, iDelim)
- End If
- iDelim = InStr(sInfo, "ProductVersion")
- If iDelim > 0 Then
- iDelim = iDelim + 16
- lblValue(9).Caption = Mid$(sInfo, iDelim)
- End If
-
- Else
- GoTo invalid_file_info_error
- End If
- Else
- GoTo invalid_file_info_error
-
- End If
- End If
- GetFileVersionData_Exit:
- Exit Sub
- GetFileVersionData_Error:
- MsgBox "Error " & Format$(Err) & ": " & Error$ & " in GetFileVersionData"
- Resume GetFileVersionData_Exit
- invalid_file_info_error:
- lblValue(3).Caption = "Not a program file, or does not contain version info."
- GoTo GetFileVersionData_Exit
- End Sub
- Private Sub cmdFileBrowse_Click()
- End Sub
- Private Sub Dir1_Change()
- File1.Path = Dir1.Path
- End Sub
- Private Sub Drive1_Change()
- Dir1.Path = Drive1.Drive
- End Sub
- Private Sub File1_Click()
- txtFileName.Text = File1.Path & "\" & File1.filename
- GetFileVersionData
- End Sub
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- On Error GoTo Form_KeyDown_Error
- If KeyCode = vbKeyReturn Then
- If txtFileName <> "" Then
- If InStr(txtFileName.Text, "*") Then
- File1.Pattern = txtFileName.Text
- Else
- GetFileVersionData
- End If
- KeyCode = 0
- End If
- End If
- Form_KeyDown_Exit:
- Exit Sub
- Form_KeyDown_Error:
- MsgBox "Error " & Format$(Err) & ": " & Error$ & " in Form_KeyDown"
- Resume Form_KeyDown_Exit
- End Sub
- Private Sub txtFileName_GotFocus()
- On Error GoTo txtFileName_GotFocus_Error
- If txtFileName.Text <> "" Then
- txtFileName.SelStart = 0
- txtFileName.SelLength = Len(txtFileName.Text)
- End If
- txtFileName_GotFocus_Exit:
- Exit Sub
- txtFileName_GotFocus_Error:
- MsgBox "Error " & Format$(Err) & ": " & Error$ & " in txtFileName_GotFocus"
- Resume txtFileName_GotFocus_Exit
- End Sub
- Private Sub txtFileName_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then KeyAscii = 0
- End Sub
-